import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home/Home.vue";

// import Layout from '../components/layout/index.vue';

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    component: Home
  },
  // {
  //   path: "/successCase",
  //   // component: Layout,
  //   // meta: { hidden: true },
  //   redirect: "/successCase/operatingLoan",
  //   children: [
  //     {
  //       path: "operatingLoan",
  //       name: "OperatingLoan",
  //       component: () => import(/* webpackChunkName: "successCase" */ '../views/SuccessCase/operatingLoan.vue')
  //     }
  //   ]
  // },
  {
    path: "/operatingLoan",
    name: "OperatingLoan",
    component: () => import(/* webpackChunkName: "successCase" */ "../views/SuccessCase/operatingLoan.vue")
  },
  {
    path: "/onlineCarRental",
    name: "OnlineCarRental",
    component: () => import(/* webpackChunkName: "successCase" */ "../views/SuccessCase/OnlineCarRental.vue")
  },
  {
    path: "/consumerFinance",
    name: "ConsumerFinance",
    component: () => import(/* webpackChunkName: "successCase" */ "../views/SuccessCase/ConsumerFinance.vue")
  },
  {
    path: "/supplyChainFinance",
    name: "SupplyChainFinance",
    component: () => import(/* webpackChunkName: "successCase" */ "../views/SuccessCase/SupplyChainFinance.vue")
  },
  // {
  //   path: "/mortgageLoan",
  //   name: "MortgageLoan",
  //   component: () => import(/* webpackChunkName: "successCase" */ "../views/SuccessCase/MortgageLoan.vue")
  // },
  {
    path: "/wealthAssets",
    name: "WealthAssets",
    component: () => import(/* webpackChunkName: "successCase" */ "../views/SuccessCase/WealthAssets.vue")
  },
  {
    path: "/smartSMS",
    name: "SmartSMS",
    component: () => import(/* webpackChunkName: "successCase" */ "../views/SuccessCase/SmartSMS.vue")
  },
  {
    path: "/smartCard",
    name: "SmartCard",
    component: () => import(/* webpackChunkName: "successCase" */ "../views/SuccessCase/SmartCard.vue")
  },
  {
    path: "/contactUs",
    name: "ContactUs",
    component: () =>
      import(/* webpackChunkName: "contactUs" */ "../views/ContactUs/ContactUs.vue")
  },
  {
    path: "/customers",
    name: "Customers.vue",
    component: () =>
      import(/* webpackChunkName: "AboutUs" */ "../views/About/Customers.vue")
  },
  // {
  //   path: "/aboutUs",
  //   name: "AboutUs",
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   redirect: "/companyProfile",
  //   children: [
  //     {
  //       path: "companyProfile",
  //       name: "CompanyProfile",
  //       component: () => import(/* webpackChunkName: "AboutUs" */ "../views/About/companyProfile.vue")
  //     },
  //     {
  //       path: "technicalAdvantages",
  //       name: "TechnicalAdvantages",
  //       component: () => import(/* webpackChunkName: "AboutUs" */ "../views/About/TechnicalAdvantages.vue")
  //     },
  //   ]
  // },
  {
    path: "/technicalAdvantages",
    name: "TechnicalAdvantages",
    component: () => import(/* webpackChunkName: "AboutUs" */ "../views/About/TechnicalAdvantages.vue")
  },
  {
    path: "/companyProfile",
    name: "CompanyProfile",
    component: () =>
      import(/* webpackChunkName: "AboutUs" */ "../views/About/companyProfile.vue")
  },
  {
    path: "/joinUs",
    name: "JoinUs",
    component: () => import(/* webpackChunkName: "AboutUs" */ "../views/About/JoinUs.vue")
  }
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
  scrollBehavior(to, from, saveTop){
    if (saveTop) {
      return saveTop;
    } else {
      return { x: 0, y: 0 };
    }
  }
});

export default router;
